﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Backup.Services.Entities;
using BackupObjects;

namespace Backup.Services.Logic
{
    /// <summary>
    /// The logic interface for backup service.
    /// </summary>
    public interface IBackupServiceLogic
    {
        /// <summary>
        /// Load a file based on the id of the file.
        /// </summary>
        /// <param name="id">The id of the file.</param>
        /// <param name="userName">The name of the user that owns the file.</param>
        /// <returns>The file entity.</returns>
        BackupEntity LoadById(Guid id, string userName);

        /// <summary>
        /// Load a file based on the name of the file.
        /// </summary>
        /// <param name="name">The name of the file.</param>
        /// <param name="userName">The name of the user that owns the file.</param>
        /// <returns>The file entity.</returns>
        BackupEntity LoadByName(string name, string userName);

        /// <summary>
        /// Load all the files of a given user.
        /// </summary>
        /// <param name="userName">The name of the user.</param>
        List<BackupEntity> LoadAll(string userName);

        /// <summary>
        /// Savea given file.
        /// </summary>
        /// <param name="backupEntity">The file that need to be saved.</param>
        void Save(BackupEntity backupEntity);

        /// <summary>
        /// Delete a specific file.
        /// </summary>
        /// <param name="id">The id of the file.</param>
        /// <param name="userName">The owner of the file.</param>
        void Delete(Guid id, string userName);

        /// <summary>
        /// Get a stream of a specific file.
        /// </summary>
        /// <param name="id">The id of the file.</param>
        /// <param name="userName">The owner of the file.</param>
        /// <returns>The stream of the file.</returns>
        Stream GetBackupStream(Guid id, string userName);

        /// <summary>
        /// Get all the backup entities that have the given tags.
        /// </summary>
        /// <param name="tagids">The tag list.</param>
        /// <returns>The list of entities with the tag ids.</returns>
        List<BackupEntity> GetBackupEntitiesByTags(List<Guid> tagids);

        /// <summary>
        /// Get all the backup entities that have the given tag.
        /// </summary>
        /// <param name="tagid">The tag id.</param>
        /// <returns>The list of entities with the tag id.</returns>
        List<BackupEntity> GetBackupEntitiesByTag(Guid tagid);
    }   
}
